#include "S_RGB.h"

void RGBInit(void)//初始化,将三个通道的CCR全部清零
{
    HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_1);
    HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_2);
    HAL_TIM_PWM_Start(&htim3,TIM_CHANNEL_3);
    htim3.Instance->CCR1=0;
    htim3.Instance->CCR2=0;
    htim3.Instance->CCR3=0;
}

void RGBColor(uint8_t Rval, uint8_t Gval, uint8_t Bval)//根据参数调节RGB三通道的亮度
{
    htim3.Instance->CCR1=htim3.Instance->ARR*Rval/100;
    htim3.Instance->CCR2=htim3.Instance->ARR*Gval/100;
    htim3.Instance->CCR3=htim3.Instance->ARR*Bval/100;
}
